package com.deepclassifieds.daas.common;

import java.io.Serializable;

public final class Name implements Serializable, Comparable<Name> {
	
	private static final long serialVersionUID = 20100908231708L;
	
	private final String value;

	public Name(String value) {
		Reject.ifNullOrEmpty(value);
		//
		// other validations
		//
		this.value = value;
	}

	@Override
	public int hashCode() {
		return value.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		if (obj == null) return false;
		if(obj instanceof Name) {
			return this.value.equals(((Name)obj).value);
		}
		return false;
	}

	@Override
	public String toString() {
		return value;
	}

	@Override
	public int compareTo(Name other) {
		return this.value.compareTo(other.value);
	}

	
}
